import React, { Component } from 'react';
import './Tabbar.scss'
import { TabBar } from 'antd-mobile'
import { withRouter } from 'react-router-dom'
class Tabbar extends Component {
    constructor(props){
        super(props)
        this.state={
            list:[
                {
                    key:'/index/home',
                    icon:"iconfont icon-xiazai45",
                    title:"首页"
                },
                {
                    key:'/index/classify',
                    icon:"iconfont icon-fenlei ",
                    title:"分类"
                },
                {
                    key:'/index/allgood',
                    icon:"iconfont icon-xingzhuang",
                    title:"全部"
                },
                {
                    key:'/index/shopcart',
                    icon:"iconfont icon-gouwuche",
                    title:"购物车"
                },
                {
                    key:'/index/mine',
                    icon:"iconfont icon-wode",
                    title:"个人中心"
                },

            ]
        }
    }
    handleClick=(key)=>{
         this.props.history.push(key)
    }
    render() {
        return (
            <TabBar onChange={this.handleClick}  className="mytabbar" >
                {
                this.state.list.map(item => (
                    <TabBar.Item key={item.key} className={item.icon} title={item.title} />
                ))
                }
            </TabBar>
        );
    }
}

export default withRouter(Tabbar);